<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" id="globalMessages"/>
    
    <h:form id="teeSearch" styleClass="edit">
    
        <rich:simpleTogglePanel label="Tee search parameters" switchType="ajax">
        
        
        </rich:simpleTogglePanel>
        
        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="/TeeList.xhtml"/>
        </div>
        
    </h:form>
    
    <rich:panel>
        <f:facet name="header">Tee search results</f:facet>
    <div class="results" id="teeList">

    <h:outputText value="The tee search returned no results." 
               rendered="#{empty teeList.resultList}"/>
               
    <rich:dataTable id="teeList" 
                var="tee"
              value="#{teeList.resultList}" 
           rendered="#{not empty teeList.resultList}">
        <h:column>
            <f:facet name="header">holeId</f:facet>
            #{tee.id.holeId}
        </h:column>
        <h:column>
            <f:facet name="header">teeSetId</f:facet>
            #{tee.id.teeSetId}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="distance #{teeList.order=='distance asc' ? messages.down : ( teeList.order=='distance desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{teeList.order=='distance asc' ? 'distance desc' : 'distance asc'}"/>
                </s:link>
            </f:facet>
            #{tee.distance}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="hole id #{teeList.order=='hole.id asc' ? messages.down : ( teeList.order=='hole.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{teeList.order=='hole.id asc' ? 'hole.id desc' : 'hole.id asc'}"/>
                </s:link>
            </f:facet>
            #{tee.hole.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="teeSet id #{teeList.order=='teeSet.id asc' ? messages.down : ( teeList.order=='teeSet.id desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{teeList.order=='teeSet.id asc' ? 'teeSet.id desc' : 'teeSet.id asc'}"/>
                </s:link>
            </f:facet>
            #{tee.teeSet.id}
        </h:column>
        <h:column>
            <f:facet name="header">action</f:facet>
            <s:link view="/#{empty from ? 'Tee' : from}.xhtml" 
                   value="#{empty from ? 'View' : 'Select'}" 
                      id="tee">
                <f:param name="teeHoleId" 
                        value="#{tee.id.holeId}"/>
                <f:param name="teeTeeSetId" 
                        value="#{tee.id.teeSetId}"/>
            </s:link>
        </h:column>
    </rich:dataTable>

    </div>
    </rich:panel>
    
    <div class="tableControl">
      
        <s:link view="/TeeList.xhtml" 
            rendered="#{teeList.previousExists}" 
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/TeeList.xhtml" 
            rendered="#{teeList.previousExists}" 
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult" 
                    value="#{teeList.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/TeeList.xhtml" 
            rendered="#{teeList.nextExists}" 
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult" 
                    value="#{teeList.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/TeeList.xhtml" 
            rendered="#{teeList.nextExists}" 
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult" 
                    value="#{teeList.lastFirstResult}"/>
        </s:link>
        
    </div>
    
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/TeeEdit.xhtml"
                    id="create" 
                 value="Create tee">
            <f:param name="teeHoleId"/>
            <f:param name="teeTeeSetId"/>
        </s:button>
    </s:div>
    
</ui:define>

</ui:composition>

